<script setup>
import { ref, onMounted } from 'vue';
import AppLayout from './components/layout/AppLayout.vue';

const loading = ref(true);

onMounted(() => {
  // 模拟加载过程
  setTimeout(() => {
    loading.value = false;
  }, 1000);
  
  // 设置标题
  document.title = 'LobeChat';
});
</script>

<template>
  <div class="app-container">
    <AppLayout v-if="!loading" />
    
    <!-- 加载中状态 -->
    <div v-else class="loading-screen">
      <div class="loading-container">
        <div class="loading-logo">
          <div class="bg-gradient-to-r from-[#8153ff] to-[#93dc24] w-16 h-16 rounded-full flex items-center justify-center mb-6">
            <span class="text-white text-2xl font-bold">AI</span>
          </div>
        </div>
        <div class="loading-spinner"></div>
        <div class="loading-text">加载中...</div>
      </div>
    </div>
  </div>
</template>

<style>
:root {
  --primary-color: #8153ff;
  --secondary-color: #93dc24;
  --dark-bg: #111827;
  --darker-bg: #0F172A;
  --light-text: #F9FAFB;
  --gray-text: #9CA3AF;
  --border-color: #374151;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--dark-bg);
  color: var(--light-text);
  line-height: 1.5;
}

.app-container {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* 加载屏幕样式 */
.loading-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: var(--dark-bg);
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 20px auto;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
  border-left-color: var(--secondary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: var(--gray-text);
  font-size: 16px;
  margin-top: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}
</style>
